# @Author:Peng Cao
# @File: pra01.py
# @Software: PyCharm
import unittest
from base.rq import RunMain


class TEST01(unittest.TestCase):

    @classmethod
    def setUpClass(cls) -> None:
        print("类执行之前的方法")

    @classmethod
    def tearDownClass(cls) -> None:
        print("类执行之后的方法")

    def setUp(self) -> None:
        print("test----set_up")

    def tearDown(self) -> None:
        print("test----tear_down")

    def test_case01(self):
        url = "http://120.76.52.151:8000/api/login/"
        data = {"username": "admin", "password": "123456"}
        run = RunMain()
        res = run.run_main(url=url, method="POST", data=data)
        print('这是一个测试01')
        self.assertEqual(res['msgCode'], "1", "测试成功")

    @unittest.skip("test_case02")  # 参数为用例名
    def test_case02(self):
        print('这是一个测试02')
